/* eslint-disable */
export default {
  data() {
    return {
      // 资产数据
      projectData: [
        {
          status:'1',
          contractNo: '0001201911025861',
          assetName: 'xxx项目1',
          assetType: '制造业',
          startTime: '2020-3-1',
          endTime: '2022-3-1',
          taskNum: 3,
          finish: '30/45'
        },
        {
          status:'0',
          contractNo: '0001201911025862',
          assetName: 'xxx项目2',
          assetType: '建筑业',
          startTime: '2021-4-1',
          endTime: '2022-4-1',
          taskNum: 7,
          finish: '26/60'
        },
        {
          status:'0',
          contractNo: '0001201911025863',
          assetName: 'xxx项目3',
          assetType: '制造业',
          startTime: '2020-5-20',
          endTime: '2021-6-1',
          taskNum: 7,
          finish: '45/63'
        },
        {
          status:'0',
          contractNo: '0001201911025864',
          assetName: 'xxx项目4',
          assetType: '服务业',
          startTime: '2020-2-1',
          endTime: '2020-12-1',
          taskNum: 3,
          finish: '30/45'
        },
        {
          status:'0',
          contractNo: '0001201911025865',
          assetName: 'xxx项目5',
          assetType: '制造业',
          startTime: '2020-9-1',
          endTime: '2021-9-1',
          taskNum: 5,
          finish: '9/70'
        },
        {
          status:'0',
          contractNo: '0001201911025866',
          assetName: 'xxx项目6',
          assetType: '服务业',
          startTime: '2020-3-1',
          endTime: '2022-3-1',
          taskNum: 10,
          finish: '33/45'
        },
      ],
      processingNode: [
        {
          id: 1,
          nodeName: '项目公司营业执照及公章',
          startTime: '2020-01-20',
          endTime: '2020-03-30',
          actualStartTime: '2020-01-20',
          actualEndTime: '2020-03-30',
          plannedHours: '10%',
          precondition: '暂无条件',
          responsibleDepartment: '投资与人才促进部',
          desc: '备注',
        }, {
          id: 2,
          nodeName: '可研',
          startTime: '2020-01-20',
          endTime: '2020-03-30',
          actualStartTime: '2020-01-20',
          actualEndTime: '2020-03-30',
          plannedHours: '20%',
          precondition: '暂无条件',
          responsibleDepartment: '规土部',
          desc: '备注',
        },
        // {
        //   id: 3,
        //   nodeName: '备案证',
        //   startTime: '2020-01-20',
        //   endTime: '2020-03-30',
        //   actualStartTime: '2020-01-20',
        //   actualEndTime: '2020-03-30',
        //   plannedHours: '30%',
        //   precondition: '暂无条件',
        //   responsibleDepartment: '规土部',
        //   desc: '备注',
        // }, {
        //   id: 4,
        //   nodeName: '调查',
        //   startTime: '2020-01-20',
        //   endTime: '2020-03-30',
        //   actualStartTime: '2020-01-20',
        //   actualEndTime: '2020-03-30',
        //   plannedHours: '40%',
        //   precondition: '暂无条件',
        //   responsibleDepartment: '规土部',
        //   desc: '备注',
        // }, {
        //   id: 5,
        //   nodeName: '拆迁红线（勘测定界）',
        //   startTime: '2020-01-20',
        //   endTime: '2020-03-30',
        //   actualStartTime: '2020-01-20',
        //   actualEndTime: '2020-03-30',
        //   plannedHours: '50%',
        //   precondition: '暂无条件',
        //   responsibleDepartment: '规土部',
        //   desc: '备注',
        // },
      ],
      completedNode: [
        {
          id: 1,
          nodeName: '拆迁协议',
          startTime: '2020-01-20',
          endTime: '2020-03-30',
          actualStartTime: '2020-01-20',
          actualEndTime: '2020-03-30',
          plannedHours: '2个月',
          precondition: '暂无条件',
          responsibleDepartment: '规土部',
          desc: '备注',
        },
      ],
      // 新增资产弹窗
      dialogAssetAdd: {
        title: '项目进展',
        status: false,
      },

      // 节点信息
      dialogNodeInfo: {
        title: '节点信息',
        status: false,
        type: 0
      },

      timeValueActual: [],

      fileList: [{
        name: '项目说明文档.xlsx',
        url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'
      }, {
        name: '项目说明.docx',
        url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'
      }],

      // 节点表单
      nodeFrom: {
        id: 1,
        nodeName: '立项', // 节点名称
        startTime: '2020-01-20', // 计划开始时间
        endTime: '2020-03-30', // 计划结束时间
        actualStartTime: '2020-01-20', // 实际开始时间
        actualEndTime: '2020-03-30', // 实际结束时间
        plannedHours: '2个月', // 计划工时
        precondition: '暂无条件', // 前置条件
        responsibleDepartment: '投资与人才促进部', // 责任部门
        desc: '工程备注信息' // 备注
      },

      nodeData: [

        {
          id: "1",
          label: '立项',
          level: '1级节点',
          startTime: '2020-01-20',
          endTime: '2020-03-30',
          actualStartTime: '2020-01-20',
          actualEndTime: '2020-03-30',
          plannedHours: '2个月',
          precondition: '暂无条件',
          responsibleDepartment: '投资与人才促进部',
          desc: '工程备注信息',
          children: [
            {
              id: "1-1",
              label: '确定建设主体',
              level: '2级节点',
              startTime: '2020-01-20',
              endTime: '2020-03-30',
              actualStartTime: '2020-01-20',
              actualEndTime: '2020-03-30',
              plannedHours: '2个月',
              precondition: '暂无条件',
              responsibleDepartment: '规土局',
              desc: '',
              children: [{
                id: "1-1-1",
                label: '项目公司营业执照及公章',
                startTime: '2020-01-20',
                endTime: '2020-03-30',
                actualStartTime: '2020-01-20',
                actualEndTime: '2020-03-30',
                plannedHours: '2个月',
                precondition: '暂无条件',
                responsibleDepartment: '规土局',
                desc: '',
              }]
            },
            {
              id: "1-2",
              label: '立项',
              level: '2级节点',
              startTime: '2020-01-20',
              endTime: '2020-03-30',
              actualStartTime: '2020-01-20',
              actualEndTime: '2020-03-30',
              plannedHours: '2个月',
              precondition: '暂无条件',
              responsibleDepartment: '规土局',
              desc: '',
              children: [{
                id: "1-2-1",
                label: '备案证',
                level: '3级节点',
                startTime: '2020-01-20',
                endTime: '2020-03-30',
                actualStartTime: '2020-01-20',
                actualEndTime: '2020-03-30',
                plannedHours: '2个月',
                precondition: '暂无条件',
                responsibleDepartment: '规土局',
                desc: '',
                children: [{
                  id: "1-2-1-1",
                  label: '科研',
                  level: '4级节点',
                  startTime: '2020-01-20',
                  endTime: '2020-03-30',
                  actualStartTime: '2020-01-20',
                  actualEndTime: '2020-03-30',
                  plannedHours: '2个月',
                  precondition: '概念方案',
                  responsibleDepartment: '规土局',
                  desc: '',
                },
                  {
                    id: "1-2-1-2",
                    label: '备案证',
                    level: '4级节点',
                    startTime: '2020-01-20',
                    endTime: '2020-03-30',
                    actualStartTime: '2020-01-20',
                    actualEndTime: '2020-03-30',
                    plannedHours: '2个月',
                    precondition: '可研',
                    responsibleDepartment: '规土局',
                    desc: '',
                  }]
              }]
            }]
        }],
    }
  },
  mounted() {

  },
  methods: {
    // 资产弹窗
    dialogAsset(row) {
      this.assetAddFrom = row
      this.dialogAssetAdd.status = true
    },

    // 上传附件
    handleRemove(file, fileList) {
      console.log(file, fileList);
    },
    handlePreview(file) {
      console.log(file);
    },
    handleExceed(files, fileList) {
      this.$message.warning(`当前限制选择 3 个文件，本次选择了 ${files.length} 个文件，共选择了 ${files.length + fileList.length} 个文件`);
    },
    beforeRemove(file, fileList) {
      return this.$confirm(`确定移除 ${ file.name }？`);
    },

    // 节点信息
    nodeInfoMore(item,type){
      this.timeValueActual = []
      console.log(item)
      this.nodeFrom = item
      this.timeValueActual.push(item.startTime)
      this.timeValueActual.push(item.endTime)
      this.dialogNodeInfo.status = true
      if(type == 0){
        this.dialogNodeInfo.type = 0
      }else{
        this.dialogNodeInfo.type = 1
      }
    },

    // 分离日期
    separateTime(type) {
      console.log(this.timeValue)
      console.log(this.timeValueActual)
      console.log(type)
      if (type == 0) {
        this.nodeFrom.startTime = this.timeValue[0]
        this.nodeFrom.endTime = this.timeValue[1]
      } else {
        this.nodeFrom.actualStartTime = this.timeValueActual[0]
        this.nodeFrom.actualEndTime = this.timeValueActual[1]
      }
    },

    // 更改节点状态
    completedNodeFrom(type){
      if(type == 0){
        this.completedNode.push(this.nodeFrom)
        this.dialogNodeInfo.status = false
        let index = this.processingNode.findIndex( item => item.id == this.nodeFrom.id)
        this.processingNode.splice(index,1);
      }else{
        this.processingNode.push(this.nodeFrom)
        this.dialogNodeInfo.status = false
        let index = this.completedNode.findIndex( item => item.id == this.nodeFrom.id)
        this.completedNode.splice(index,1);
      }
    }
  }
}
